import sys, os
import waflib.Task, waflib.TaskGen
from waflib.Options import options

def build(bld):
    if options.skip_build_tests:
        return

    flist = 'c cxx cprogram'

    if 'web' in bld.env['PLATFORM']:
        flist = flist + ' web'

    if bld.env['PLATFORM'] in ('x86_64-macos','arm64-macos'):
        bld.env.append_value('LINKFLAGS', ['-framework', 'IOKit'])

    glfw_js = '%s/ext/lib/%s/js/library_glfw.js' % (bld.env.DYNAMO_HOME, bld.env.PLATFORM)

    font_viewer = bld.program(features = flist,
                              source   = 'fontview.cpp deja_vu_sans.font vera_mo_bd.font font.vp font.fp font.material',
                              use      = 'RENDER CRASH GRAPHICS RESOURCE HID DDF FONT DMGLFW OPENGL SOCKET SCRIPT LUA EXTENSION DLIB PROFILE_NULL PLATFORM APP gamesys',
                              web_libs = ['library_sys.js', glfw_js],
                              includes = ['../../../../src',  '../../../build', '../../../../build/proto'],
                              target   = 'fontview')
    font_viewer.install_path = None
